package com.jimmy.medical.repository;

import com.jimmy.medical.entity.Member;
import com.jimmy.medical.entity.RechargeRecordServiceItem;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface RechargeRecordServiceItemRepository extends JpaSpecificationExecutor<RechargeRecordServiceItem>, PagingAndSortingRepository<RechargeRecordServiceItem, Long> {

    @Query("select o from RechargeRecordServiceItem o where o.record.rechargeType=?1 and o.record.member=?2 and o.item.id=?3")
    RechargeRecordServiceItem findRestCounts(String rechargeType, Member member, Long itemId);
}
